<%@page import="java.util.Calendar"%>
<%@page import="java.util.GregorianCalendar"%>
<%@page import="java.util.List"%>
<%@page import="com.mongodb.BasicDBObject"%>
<%@page import="devboard.dbutil.MongoUtil"%>
<%@page import="com.mongodb.DBObject"%>
<%@page import="com.mongodb.DBCursor"%>
<%@page import="com.mongodb.DBCollection"%>
<%@page import="com.mongodb.Mongo" %>
<%@page import="com.mongodb.DB" %>
<%@page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>


<!DOCTYPE html>
<html>
	<head>
		<link rel="icon" type="image/png" href="favicon.png" >
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>filter</title>
		<link rel="stylesheet" href="css/Global.css" type="text/css"> 
		<script type="text/javascript" src="js/Filter.js"></script> 
	</head>
	<body>


<div id="filterConteiner" class="st">
	<form id="filter" action="Filter.jsp" method="post">
		<table>
			<tr>
				<td>project:</td>
				<td>
					<%List<?> projects=MongoUtil.getCollection("Tasks").distinct("project");%>
					<select id="projectSelect" name="projectSelect" class="forms" multiple="multiple">
						<option value="All">All</option>
					<%for(Object project:projects){%>
						<option value="<%=project %>"><%=project %></option>
					<%}%>
					</select>
				</td>
			</tr>
			<tr>
				<td>from date:</td>
				<td><input type=text size=7 name="fromDate" value="22.12.2011"></td>
			</tr>
			<tr>
				<td>to date:</td>
				<%GregorianCalendar time=new GregorianCalendar();
				String stime="";
				stime+=time.get(GregorianCalendar.DAY_OF_MONTH)+".";
				stime+=(time.get(GregorianCalendar.MONTH)+1)+".";
				stime+=time.get(GregorianCalendar.YEAR);
				%>
				<td><input value="<%=stime %>" type=text size=7 name="toDate"></td>
			</tr>
			<tr>
				<td>status:</td>
				<td>
					<select name="boolSelect" class="forms">
						<option value="all">All</option>
						<option value="reproduced">reproduced</option>
						<option value="inProgress">fixed</option>
						<option value="delivered">delivered</option>
						<option value="successfully">successfully</option>
					</select>
				</td>
			</tr>
			<tr>
				<td>developer:</td>
				<td>
					<select name="developerSelect" class="forms">
						<option value="all">All</option>
						<%
						DBCollection users=MongoUtil.getCollection("Users");
						DBCursor cursor=users.find(new BasicDBObject("role","developer"));
						while(cursor.hasNext()){
							DBObject user=cursor.next();
							out.println("<option value=\""+user.get("_id")+"\" >"+user.get("firstName")+" "+user.get("lastName")+"</option>");
						}
						%>
						<option value="nobody">Mr. Nobody</option>
					</select>
				</td>
			</tr>
			<tr><td colspan="2"><button class="forms" onclick="filter();return false;">filter</button></td></tr>
		</table>
	</form>
</div>
</body>
</html>